package the.workshop.milktea.infrastructure.common;

import lombok.Getter;

import java.util.Arrays;

public enum SugarTypeEnum {
    THREE(3, "3分"),
    FIVE(2, "5分"),
    SEVEN(1, "7分");

    @Getter
    private Integer code;

    @Getter
    private String name;

    SugarTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String getName(int code) {
        return Arrays.stream(SugarTypeEnum.values()).filter(it -> it.getCode() == code).findFirst().get().getName();
    }
}
